<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <input id="myFile" type="file" ><input type="button" value="上传" onclick="myUpload()">
    <img id="showImg" src=""/>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/1.9.0/axios.js"></script>
<script>
    const myUpload =   async ()=>{
        let files = document.getElementById("myFile").files
        console.log(files[0])
        let newForm = new FormData();
        newForm.append("myFile",files[0])
        let resp = await  axios.post("/projectDemo/myupload",newForm)
        document.getElementById("showImg").src = resp.data.returnData
    }


</script>

</html>